<?

/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/

$App->sApplicationCSS = "/bigdaddy.css";

switch($_REQUEST["page"])
{
	//====Main CronTabControl Pagee
	case "CrontabIndex":
		
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		$CronCategories = $BigDaddyData->GetCronCategories();
		
		$aCatToLinks["#"] = " -- Choose -- ";
		
		if (is_array($CronCategories))
		{
			foreach ($CronCategories as $nIndex => $row)
			{
				$aCatToLinks[$_SERVER["PHP_SELF"]."?page=CrontabIndex&catID=".$row["ID"]] = $row["name"];
			}
		}
		$Content->AddOption("cat_txt", "Category:", 3, "");
		$Content->AddOption("cat", "", 2, "javascript:location.href=this.options[this.selectedIndex].value", null, $aCatToLinks);
		$Content->AddOption("break1", "", 4, "#");
		$Content->AddOption("opt1", "Show All", 0, "{$_SERVER["PHP_SELF"]}?page=CrontabIndex", "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt2", "Show Running", 0, "{$_SERVER["PHP_SELF"]}?page=CrontabIndex&show_only=running", "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt3", "Only Enabled", 0, "{$_SERVER["PHP_SELF"]}?page=CrontabIndex&show_only=enabled", "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Only Disabled", 0, "{$_SERVER["PHP_SELF"]}?page=CrontabIndex&show_only=disabled", "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Only Delayed", 0, "{$_SERVER["PHP_SELF"]}?page=CrontabIndex&show_only=delayed", "");

		$pageParams["title"]="Crontab Control";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/index.inc";
		break;
	case "CronCategory":
	
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
	
		$pageParams["title"]="Crontab Categories";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/category.inc";
		break;
	case "CronAddNew":
		if (!$BigDaddy->IsUserAllowedByAction("cron-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
	
		$pageParams["title"]="Add New Cron Job";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/cronform.inc";
		$type="addnew";
		break;
	case "CronDelay":
		if (!$BigDaddy->IsUserAllowedByAction("cron-delay"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
	
		$pageParams["title"]="Delay Cron";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/crondelay.inc";

		$cronInfo = $BigDaddyData->GetCronInfoByID($_REQUEST["cronID"]);

		break;
	case "CronDelayAll":
		if (!$BigDaddy->IsUserAllowedByAction("cron-delay"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
	
		$pageParams["title"]="Delay All Crons in Category";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/crondelayall.inc";
		break;
	case "CronDelayGlobal":
		if (!$BigDaddy->IsUserAllowedByAction("cron-global"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
	
		$pageParams["title"]="Delay Crons Globally";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/crondelayglobal.inc";
		break;
	case "CronEdit":
		if (!$BigDaddy->IsUserAllowedByAction("cron-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
	
		$pageParams["title"]="Edit Cron Job";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/cronform.inc";
		
		$cronInfo = $BigDaddyData->GetCronInfoByID($_REQUEST["cronID"]);

		$type="edit";
		break;
	case "CronViewDetails":
	
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		
		$Content->AddOption("opt1", "Audit", 0, "{$_SERVER["PHP_SELF"]}?page=CronAudit&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break1", "", 4, "#");
		$Content->AddOption("opt2", "Log", 0, "{$_SERVER["PHP_SELF"]}?page=CronLog&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt3", "History", 0, "{$_SERVER["PHP_SELF"]}?page=CronHistory&cronID={$_REQUEST["cronID"]}", "");
	
		$pageParams["title"]="View Cron Details";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/cronview.inc";
		
		$cronInfo = $BigDaddyData->GetCronInfoByID($_REQUEST["cronID"]);

		break;
	case "CronAudit":
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		
		$Content->AddOption("opt1", "View Details", 0, "{$_SERVER["PHP_SELF"]}?page=CronViewDetails&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt2", "Audit", 0, "{$_SERVER["PHP_SELF"]}?page=CronAudit&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break1", "", 4, "#");
		$Content->AddOption("opt3", "Log", 0, "{$_SERVER["PHP_SELF"]}?page=CronLog&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt4", "History", 0, "{$_SERVER["PHP_SELF"]}?page=CronHistory&cronID={$_REQUEST["cronID"]}", "");
		
		$displayParams["jsTimeline"] = true;
		$displayParams["jsTimelineData"] = $_SERVER["PHP_SELF"]."?page=CronAuditXML&cronID=".$_REQUEST["cronID"];
		$displayParams["jsTimelineOptions"]["topCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["bottomCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["topIntervalUnit"]="DAY";
		$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="MONTH";
		
		$cronInfo = $BigDaddyData->GetCronInfoByID($_REQUEST["cronID"]);
		
		
		$pageParams["title"]="Audit for ".$cronInfo["filename"];
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/cronaudit.inc";
		break;
	case "CronLog":
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		
		$Content->AddOption("opt1", "View Details", 0, "{$_SERVER["PHP_SELF"]}?page=CronViewDetails&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt2", "Audit", 0, "{$_SERVER["PHP_SELF"]}?page=CronAudit&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break1", "", 4, "#");
		$Content->AddOption("opt3", "Log", 0, "{$_SERVER["PHP_SELF"]}?page=CronLog&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt4", "History", 0, "{$_SERVER["PHP_SELF"]}?page=CronHistory&cronID={$_REQUEST["cronID"]}", "");
		
		$cronInfo = $BigDaddyData->GetCronInfoByID($_REQUEST["cronID"]);

		$pageParams["title"]="Log for ".$cronInfo["filename"];
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/cronlog.inc";
		break;
	case "CronHistory":
		include_once($_SERVER["DOCUMENT_ROOT"]."/crontab/options.inc");
		
		$Content->AddOption("opt1", "View Details", 0, "{$_SERVER["PHP_SELF"]}?page=CronViewDetails&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt2", "Audit", 0, "{$_SERVER["PHP_SELF"]}?page=CronAudit&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break1", "", 4, "#");
		$Content->AddOption("opt3", "Log", 0, "{$_SERVER["PHP_SELF"]}?page=CronLog&cronID={$_REQUEST["cronID"]}", "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt4", "History", 0, "{$_SERVER["PHP_SELF"]}?page=CronHistory&cronID={$_REQUEST["cronID"]}", "");
		
		$cronInfo = $BigDaddyData->GetCronInfoByID($_REQUEST["cronID"]);

		$pageParams["title"]="History for ".$cronInfo["filename"];
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/crontab/cronhistory.inc";
		break;
	case "CronAuditXML":
		$pageParams["noDisplay"] = 1;
		
		$aFilter = array(
		"application" => "crontab",
		"type" => "cron_edit",
		"primaryNumericID" => $_REQUEST["cronID"]
		);
		
		$aAuditData = $Audit->getAuditData($aFilter, "modifiedDate");
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/auditdataxml.inc";
		
		break;
	
	//====Main Monitoring Options Page
	case "MonitorIndex":
		$pageParams["title"]="Monitoring Options";
		$pageParams["sectiontitle"]="monitor";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/index.inc";
		break;
	case "MonIniFiles":
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/ini_options.inc");
		$pageParams["title"]="IniFiles Control";
		$pageParams["sectiontitle"]="inifiles";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/inifile.inc";
		break;
	case "PhoneTags":
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/tag_options.inc");
		$pageParams["title"]="Phone/Email Tags";
		$pageParams["sectiontitle"]="inifiles";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/phonetags.inc";
		break;
	case "PhoneTagAdd":
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/tag_options.inc");
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		
		$pageParams["title"]="Add Phone/Email Tag";
		$pageParams["sectiontitle"]="inifiles";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/tagform.inc";
		$type="addnew";
		break;
	case "PhoneTagEdit":
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/tag_options.inc");
		$pageParams["title"]="Edit Phone/Email Tag";
		$pageParams["sectiontitle"]="inifiles";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/tagform.inc";
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		
		$tagInfo = $BigDaddyData->GetPhoneTagsByID($_REQUEST["tagID"]);
		$type="edit";
		
		break;
	case "MonIniView":
		if ($BigDaddy->IsUserAllowedByAction("meta-admin"))
		{
			$Content->AddOption("opt1", "Edit IniFile", 0, "/index.html?page=MonEditIni&iniID=".$_REQUEST["iniID"], "");
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/ini_options.inc");
		$pageParams["title"]="View INI File";
		$pageParams["sectiontitle"]="inifiles";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/iniview.inc";
		break;
	case "MonEditIni":
		if (!$BigDaddy->IsUserAllowedByAction("meta-admin"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/ini_options.inc");
		$pageParams["title"]="Edit INI File";
		$pageParams["sectiontitle"]="inifiles";
		
		$iniInfo = $BigDaddyData->GetIniFileByID($_REQUEST["iniID"]);
		$type="edit";

		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/iniform.inc";
		break;
	case "MonAddIni":
		if (!$BigDaddy->IsUserAllowedByAction("meta-admin"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/ini_options.inc");
		$pageParams["title"]="Create New INI File";
		$pageParams["sectiontitle"]="inifiles";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/iniform.inc";
		$type="addnew";
		break;
	case "MonAddMod":
		if (!$BigDaddy->IsUserAllowedByAction("meta-admin"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/mod_options.inc");
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		
		$pageParams["title"]="Create New Module Entry";
		$pageParams["sectiontitle"]="modules";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/modform.inc";
		$type="addnew";
		break;
	case "MonModules":

		$pageParams["title"]="Modules Control";
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/mod_options.inc");
		$pageParams["sectiontitle"]="modules";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/modules.inc";
		break;
	case "MonModView":
		$modInfo = $BigDaddyData->GetModuleByID($_REQUEST["modID"]);
		if ($BigDaddy->IsUserAllowedByAction("meta-admin"))
		{
			$Content->AddOption("opt1", "Edit Module", 0, $_SERVER["PHP_SELF"]."?page=MonEditMod&modID=".$modInfo["ID"], "");
		}
		
		
		$pageParams["title"]="View Module Info";
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/mod_options.inc");
		$pageParams["sectiontitle"]="modules";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/modview.inc";
		break;
	case "MonEditMod":
		if (!$BigDaddy->IsUserAllowedByAction("meta-admin"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		$pageParams["title"]="Edit Module Info";
		include_once($_SERVER["DOCUMENT_ROOT"]."/monitor/mod_options.inc");
		$pageParams["sectiontitle"]="modules";
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		
		$modInfo = $BigDaddyData->GetModuleByID($_REQUEST["modID"]);
		$type="edit";

		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/monitor/modform.inc";
		break;
	//====Report Group Control Index
	case "ReportGroupIndex":
		include_once($_SERVER["DOCUMENT_ROOT"]."/reportgroup/options.inc");
		$pageParams["title"]="Report Group Control";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/reportgroup/index.inc";
		break;
	case "ReportGroupAddNew":
		include_once($_SERVER["DOCUMENT_ROOT"]."/reportgroup/options.inc");
		$pageParams["title"]="Add New Report Group Entry";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/reportgroup/reportgroupform.inc";
		$type="addnew";
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");

		break;
	case "ReportGroupHistory":
		include_once($_SERVER["DOCUMENT_ROOT"]."/reportgroup/options.inc");
		$Content->AddOption("opt1", "View Report Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ReportGroupViewDetails&serverGroupID=".$_REQUEST["serverGroupID"], "");
		
		$serverGroupInfo  = $BigDaddyData->GetReportGroupByID($_REQUEST["serverGroupID"]);
		$aModuleInfo = $BigDaddyData->GetModulesByReportGroupID($_REQUEST["serverGroupID"]);
		
		$pageParams["title"]="View History For Report Group: ".$serverGroupInfo["groupname"];
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/reportgroup/reportgrouphistory.inc";
		$type="addnew";
		break;
	case "ReportGroupAddServerMod":
		include_once($_SERVER["DOCUMENT_ROOT"]."/reportgroup/options.inc");
		
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/reportgroup/reportgroupmod.inc";
		$serverGroupInfo  = $BigDaddyData->GetReportGroupByID($_REQUEST["serverGroupID"]);
		
		$pageParams["title"]="Add Server Module To Reporting Group: ".$serverGroupInfo["groupname"];
		
		$Content->AddOption("opt8", "Save", 1, "document.f.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		$Content->AddOption("opt2", "View Report Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ReportGroupViewDetails&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt4", "Edit Report Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ReportGroupEdit&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ReportGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break3", "", 4, "#");
		
		break;
	case "ReportGroupEdit":
		include_once($_SERVER["DOCUMENT_ROOT"]."/reportgroup/options.inc");
		
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/reportgroup/reportgroupform.inc";

		$serverGroupInfo  = $BigDaddyData->GetReportGroupByID($_REQUEST["serverGroupID"]);
		
		$pageParams["title"]="Edit Report Group Entry".$serverGroupInfo["groupname"];
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		$Content->AddOption("opt2", "View Report Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ReportGroupViewDetails&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ReportGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break3", "", 4, "#");

		$type="edit";
		break;
	case "ReportGroupViewDetails":
		include_once($_SERVER["DOCUMENT_ROOT"]."/reportgroup/options.inc");

		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/reportgroup/reportgroupview.inc";

		$serverGroupInfo  = $BigDaddyData->GetReportGroupByID($_REQUEST["serverGroupID"]);

		$Content->AddOption("opt2", "Edit Report Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ReportGroupEdit&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ReportGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break3", "", 4, "#");
		
		$pageParams["title"]="View Report Group Details: ".$serverGroupInfo["groupname"];
	
		break;
	//====Server Group Control Index
	case "ServerGroupIndex":
		include_once($_SERVER["DOCUMENT_ROOT"]."/servergroup/options.inc");
		$pageParams["title"]="Server Group Control";
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/servergroup/index.inc";
		
		$Content->AddOption("opt2", "Show All", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupIndex", "");
		$Content->AddOption("break2", "", 4, "#");
		
		$Content->AddOption("opt3", "Only Enabled", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupIndex&show_only=enabled", "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Only Disabled", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupIndex&show_only=disabled", "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Only Delayed", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupIndex&show_only=delayed", "");
		
		break;
	case "ServerGroupAddNew":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		
		include_once($_SERVER["DOCUMENT_ROOT"]."/servergroup/options.inc");
		$pageParams["title"]="Add New Server Group Entry";
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/servergroup/servergroupform.inc";
		$type="addnew";
		break;
	case "ServerGroupHistory":
		include_once($_SERVER["DOCUMENT_ROOT"]."/servergroup/options.inc");
		
		$Content->AddOption("opt1", "View Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupViewDetails&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break1", "", 4, "#");
		if ($BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			$Content->AddOption("opt2", "Edit Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupEdit&serverGroupID=".$_REQUEST["serverGroupID"], "");
			$Content->AddOption("break2", "", 4, "#");
			$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
			$Content->AddOption("break3", "", 4, "#");
		}
		
		$serverGroupInfo  = $BigDaddyData->GetServerGroupByID($_REQUEST["serverGroupID"]);
		$aModuleInfo = $BigDaddyData->GetModulesByServerGroupID($_REQUEST["serverGroupID"]);
		
		$pageParams["title"]="View History For Group: ".$serverGroupInfo["groupname"];
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/servergroup/servergrouphistory.inc";
		$type="addnew";
		break;
	case "ServerGroupAddServerMod":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/servergroup/options.inc");
		
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/servergroup/servergroupmod.inc";
		$serverGroupInfo  = $BigDaddyData->GetServerGroupByID($_REQUEST["serverGroupID"]);
		
		$pageParams["title"]="Add Server Module To Group: ".$serverGroupInfo["groupname"];
		
		$Content->AddOption("opt8", "Save", 1, "document.f.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		$Content->AddOption("opt2", "View Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupViewDetails&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt4", "Edit Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupEdit&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break3", "", 4, "#");
		
		break;
	case "ServerGroupDelay":
		if (!$BigDaddy->IsUserAllowedByAction("server-delay"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/servergroup/options.inc");
		
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/servergroup/servergroupdelay.inc";
		$serverGroupInfo  = $BigDaddyData->GetServerGroupByID($_REQUEST["serverGroupID"]);
		
		$pageParams["title"]="Set Delay on Server Group Monitoring: ".$serverGroupInfo["groupname"];
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		$Content->AddOption("opt2", "View Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupViewDetails&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt4", "Edit Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupEdit&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break3", "", 4, "#");
		
		break;
	case "ServerGroupEdit":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/servergroup/options.inc");
		
		$Content->AddOption("opt8", "Save", 1, "document.bdform.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/servergroup/servergroupform.inc";

		$serverGroupInfo  = $BigDaddyData->GetServerGroupByID($_REQUEST["serverGroupID"]);
		
		$pageParams["title"]="Edit Server Group Entry".$serverGroupInfo["groupname"];
		
		$Content->AddOption("opt2", "View Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupViewDetails&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break3", "", 4, "#");

		$type="edit";
		break;
	case "ServerGroupViewDetails":
		include_once($_SERVER["DOCUMENT_ROOT"]."/servergroup/options.inc");
		
		$pageParams["sectiontitle"]="servergroup";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/servergroup/servergroupview.inc";

		$serverGroupInfo  = $BigDaddyData->GetServerGroupByID($_REQUEST["serverGroupID"]);
		
		if ($BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			$Content->AddOption("opt2", "Edit Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupEdit&serverGroupID=".$_REQUEST["serverGroupID"], "");
			$Content->AddOption("break2", "", 4, "#");
			$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
			$Content->AddOption("break3", "", 4, "#");
		}
		
		$pageParams["title"]="View Server Group Details: ".$serverGroupInfo["groupname"];
	
		break;
	case "ServerGroupAuditXML":
		$pageParams["noDisplay"] = 1;
		
		$aFilter = array(
		"application" => "servergroup",
		"type" => "servergroup_edit",
		"primaryNumericID" => $_REQUEST["serverGroupID"]
		);
		
		$aAuditData = $Audit->getAuditData($aFilter, "modifiedDate");
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/auditdataxml.inc";
		
		break;
	case "ServerGroupAudit":
		include_once($_SERVER["DOCUMENT_ROOT"]."/servergroup/options.inc");
		$Content->AddOption("opt1", "View Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupViewDetails&serverGroupID=".$_REQUEST["serverGroupID"], "");
		$Content->AddOption("break1", "", 4, "#");
		if ($BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			$Content->AddOption("opt2", "Edit Server Group Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupEdit&serverGroupID=".$_REQUEST["serverGroupID"], "");
			$Content->AddOption("break2", "", 4, "#");
			$Content->AddOption("opt3", "Add Server Module", 0, "{$_SERVER["PHP_SELF"]}?page=ServerGroupAddServerMod&serverGroupID=".$_REQUEST["serverGroupID"], "");
			$Content->AddOption("break3", "", 4, "#");
		}
		$pageParams["sectiontitle"]="server";
		
		$displayParams["jsTimeline"] = true;
		$displayParams["jsTimelineData"] = $_SERVER["PHP_SELF"]."?page=ServerGroupAuditXML&serverGroupID=".$_REQUEST["serverGroupID"];
		$displayParams["jsTimelineOptions"]["topCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["bottomCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["topIntervalUnit"]="DAY";
		$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="MONTH";
		
		$serverGroupInfo  = $BigDaddyData->GetServerGroupByID($_REQUEST["serverGroupID"]);
		
		
		$pageParams["title"]="Audit for ".$serverGroupInfo["groupname"];
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/servergroup/servergroupaudit.inc";
		break;
	//====Server Control Index
	case "ServerIndex":
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		
		$aCategory = $BigDaddyData->GetServerCategories();
		
		$aCatToLinks["#"] = " -- Choose -- ";
		
		if (is_array($aCategory))
		{
			foreach ($aCategory as $nIndex => $row)
			{
				$aCatToLinks[$_SERVER["PHP_SELF"]."?page=ServerIndex&catID=".$row["ID"]] = $row["name"];
			}
		}
		
		$aServerList = $BigDaddyData->GetServers(array("active" => -1));
		
		$aServerToLinks["#"] = " -- Choose -- ";
		
		if (is_array($aServerList["aResults"]))
		{
			foreach ($aServerList["aResults"] as $nIndex => $aRow)
			{
				$aServerToLinks[$_SERVER["PHP_SELF"]."?page=ServerViewDetails&serverID=".$aRow["serverID"]] = $aRow["hostname"];
			}
		}
		
		$Content->AddOption("cat_txt", "Category:", 3, "");
		$Content->AddOption("cat", "", 2, "javascript:location.href=this.options[this.selectedIndex].value", null, $aCatToLinks);
		$Content->AddOption("break6", "", 4, "#");
		$Content->AddOption("server_txt", "Server:", 3, "");
		$Content->AddOption("server", "", 2, "javascript:location.href=this.options[this.selectedIndex].value", null, $aServerToLinks);
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt2", "Show All", 0, "{$_SERVER["PHP_SELF"]}?page=ServerIndex", "");
		$Content->AddOption("break2", "", 4, "#");
		
		$Content->AddOption("opt3", "Only Enabled", 0, "{$_SERVER["PHP_SELF"]}?page=ServerIndex&show_only=enabled", "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Only Disabled", 0, "{$_SERVER["PHP_SELF"]}?page=ServerIndex&show_only=disabled", "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Only Delayed", 0, "{$_SERVER["PHP_SELF"]}?page=ServerIndex&show_only=delayed", "");

                // Julian adding stuff to make the server thing appear in the side bar too....
                
                $App->AddOptionHeader("server_sidebar", "Servers");
                
                array_shift($aServerToLinks);
                
                foreach ($aServerToLinks as $sLink => $sCaption)
                {
                    $App->AddOption(str_replace(".", "_", $sCaption), $sCaption, 0, $sLink, "server_sidebar");
                }
                
                

		
		$pageParams["title"]="Server Control";
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/index.inc";
		break;
	case "ServerCategory":
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$pageParams["title"]="Server Categories";
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/category.inc";
		break;
	case "ServerAddNew":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		
		$Content->AddOption("opt8", "Save", 1, "document.serverform.submit();", "save2.gif");
		
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$pageParams["title"]="Add New Server Entry";
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/serverform.inc";
		$type="addnew";
		break;
	case "ServerDelay":
		if (!$BigDaddy->IsUserAllowedByAction("server-delay"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/serverdelay.inc";

		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		
		$Content->AddOption("opt3", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		if (!$BigDaddyData->IsServerModulesInstalledByServerID($_REQUEST["serverID"]))
		{
			$Content->AddOption("break7", "", 4, "#");
			$Content->AddOption("opt7", "Copy All Monitoringr", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAllCopy&serverID=".$_REQUEST["serverID"], "");
		}

		$pageParams["title"]="Delay Server Monitoring: ".$serverInfo["hostname"];

		break;
	case "ServerDelayAll":
		if (!$BigDaddy->IsUserAllowedByAction("server-delay"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$pageParams["title"]="Delay All Server Monitoring in Category";
		$pageParams["sectiontitle"]="crontab";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/serverdelayall.inc";
		break;
	case "ServerDelayGlobal":
		if (!$BigDaddy->IsUserAllowedByAction("server-global"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$pageParams["title"]="Delay Server Monitoring Globally";
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/serverdelayglobal.inc";
		break;
	case "ServerEdit":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/serverform.inc";
		
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		
		$Content->AddOption("opt8", "Save", 1, "document.serverform.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		$Content->AddOption("opt3", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		if (!$BigDaddyData->IsServerModulesInstalledByServerID($_REQUEST["serverID"]))
		{
			$Content->AddOption("break7", "", 4, "#");
			$Content->AddOption("opt7", "Copy All Monitoringr", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAllCopy&serverID=".$_REQUEST["serverID"], "");
		}

		$pageParams["title"]="Edit Server Entry: ".$serverInfo["hostname"];
		$type="edit";
		break;
	case "ServerHistory":
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/serverhistory.inc";
		
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		$aModuleInfo = $BigDaddyData->GetServerModulesByServerID($_REQUEST["serverID"]);

		$Content->AddOption("opt3", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");

		$pageParams["title"]="View Server History: ".$serverInfo["hostname"];
		$type="edit";
		break;
	case "ServerViewDetails":
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);

		if ($BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
			$Content->AddOption("break4", "", 4, "#");
		
			$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
			$Content->AddOption("break5", "", 4, "#");
			$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
			if (!$BigDaddyData->IsServerModulesInstalledByServerID($_REQUEST["serverID"]))
			{
				$Content->AddOption("break7", "", 4, "#");
				$Content->AddOption("opt7", "Copy All Monitoringr", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAllCopy&serverID=".$_REQUEST["serverID"], "");
			}
		}
		
		$pageParams["title"]="View Server Details: ".$serverInfo["hostname"];
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/serverview.inc";
		

		$aServerList = $BigDaddyData->GetServers(array("active" => -1));
		
		
		if (is_array($aServerList["aResults"]))
		{
			foreach ($aServerList["aResults"] as $nIndex => $aRow)
			{
				$aServerToLinks[$_SERVER["PHP_SELF"]."?page=ServerViewDetails&serverID=".$aRow["serverID"]] = $aRow["hostname"];
			}
		}

                // Julian adding stuff to make the server thing appear in the side bar too....
                
                $App->AddOptionHeader("server_sidebar", "Servers");
                
                foreach ($aServerToLinks as $sLink => $sCaption)
                {
                    $App->AddOption(str_replace(".", "_", $sCaption), $sCaption, 0, $sLink, "server_sidebar");
                }
                
		
		break;
	case "ServerModAdd":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
	
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
	
		$Content->AddOption("opt8", "Save", 1, "document.serverform.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		if (!$BigDaddyData->IsServerModulesInstalledByServerID($_REQUEST["serverID"]))
		{
			$Content->AddOption("break7", "", 4, "#");
			$Content->AddOption("opt7", "Copy All Monitoringr", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAllCopy&serverID=".$_REQUEST["serverID"], "");
		}
	
		$pageParams["title"]="Add Monitoring Module To Server: ".$serverInfo["hostname"];
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermodform.inc";
		$type="addnew";
		break;
	case "ServerModEdit":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);

		$Content->AddOption("opt9", "Save", 1, "document.serverform.submit();", "save2.gif");
		$Content->AddOption("break9", "", 4, "#");
		
		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break6", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break8", "", 4, "#");
		$Content->AddOption("opt8", "Run this Module", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModRun&modID=".$_REQUEST["ID"], "");
		if (!$BigDaddyData->IsServerModulesInstalledByServerID($_REQUEST["serverID"]))
		{
			$Content->AddOption("break7", "", 4, "#");
			$Content->AddOption("opt7", "Copy All Monitoringr", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAllCopy&serverID=".$_REQUEST["serverID"], "");
		}
	
		$pageParams["title"]="Edit Monitoring Module for Server: ".$serverInfo["hostname"];
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermodform.inc";
		$type="edit";
		break;
	case "ServerModRun":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		
		//Get the Server moduleInfo
		$aServerModuleInfo = $BigDaddyData->GetServerModuleInfoByModuleID($_REQUEST["modID"]);
		
		//Get the information for the module:
		$aModuleInfo = $BigDaddyData->GetModuleByID($aServerModuleInfo["moduleID"]);
		
		//Get the server info
		$aServerInfo = $BigDaddyData->GetServerInfoByID($aServerModuleInfo["serverID"]);
		
		//fix the parameters
		$sParameters = str_replace("[hostname]", $aServerInfo["hostname"], $aServerModuleInfo["parameters"]);
		
		
		$sCommand = escapeshellcmd("/bigdaddy/modules/".$aModuleInfo["filename"]." $sParameters");
		
		$_SESSION["runModule"][$_REQUEST["modID"]] = exec($sCommand);
		
		header("Location: ".$_SERVER["PHP_SELF"]."?page=ServerModEdit&serverID={$aServerModuleInfo["serverID"]}&modID={$aServerModuleInfo["moduleID"]}&ID={$aServerModuleInfo["ID"]}");
		exit;
		
		break;		
	case "ServerModCopy":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);

		$Content->AddOption("opt8", "Save", 1, "document.f.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");

		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		if (!$BigDaddyData->IsServerModulesInstalledByServerID($_REQUEST["serverID"]))
		{
			$Content->AddOption("break7", "", 4, "#");
			$Content->AddOption("opt7", "Copy All Monitoringr", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAllCopy&serverID=".$_REQUEST["serverID"], "");
		}
		
		$pageParams["title"]="Copy Monitoring Module Settings From Server: ".$serverInfo["hostname"];
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermodcopy.inc";
		break;
	case "ServerModAllCopy":
		if (!$BigDaddy->IsUserAllowedByAction("server-edit"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		$pageParams["title"]="Copy All Monitoring Module Settings From Server: ".$serverInfo["hostname"];
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermodallcopy.inc";
		
		$Content->AddOption("opt8", "Save", 1, "document.serverform.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		
		break;
	case "ServerModDelay":
		if (!$BigDaddy->IsUserAllowedByAction("server-delay"))
		{
			header("Location: ".$_SERVER["PHP_SELF"]);
			exit;
		}
		
		$Content->AddOption("opt8", "Save", 1, "document.serverform.submit();", "save2.gif");
		$Content->AddOption("break8", "", 4, "#");
		
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		if (!$BigDaddyData->IsServerModulesInstalledByServerID($_REQUEST["serverID"]))
		{
			$Content->AddOption("break7", "", 4, "#");
			$Content->AddOption("opt7", "Copy All Monitoringr", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAllCopy&serverID=".$_REQUEST["serverID"], "");
		}
	
		$pageParams["sectiontitle"]="server";
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermoddelay.inc";

		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		$moduleInfo = $BigDaddyData->GetModuleByID($_REQUEST["modID"]);

		$pageParams["title"]="Delay Module (".$moduleInfo["name"].") Monitoring: ".$serverInfo["hostname"];

		break;
	case "ServerModuleHistory":
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		$pageParams["sectiontitle"]="server";
		
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		$moduleInfo = $BigDaddyData->GetModuleByID($_REQUEST["modID"]);
		$serverModuleInfo = $BigDaddyData->GetServerModuleInfoByModuleID($_REQUEST["ID"]);
		
		$sParam = str_replace("[hostname]", "", $serverModuleInfo["parameters"]);
		$sParam = trim($sParam);
		
		if ($sParam != "")
		{
			$sParam = "(".$sParam.")";
		}
		
		$pageParams["title"]="History for ".$serverModuleInfo["module_name"]." $sParam on ".$serverInfo["hostname"];
		if ($moduleInfo["type"]==1)
		{
			$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermodboolhistory.inc";
		}
		else
		{
			$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermodhistory.inc";
		}
		break;
	case "ServerModBoolHistoryDetails":
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$Content->AddOption("opt1", "Summary History", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModuleHistory&serverID=".$_REQUEST["serverID"]."&ID=".$_REQUEST["ID"]."&modID=".$_REQUEST["modID"], "");
		$Content->AddOption("break2", "", 4, "#");
		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		$pageParams["sectiontitle"]="server";
		
		
		switch ($_REQUEST["type"])
		{
			case 1:
				$displayParams["jsTimelineOptions"]["topIntervalUnit"]="HOUR";
				$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="DAY";
				$sTitle = "Last 24 Hours";
				$nStartTime = time()-86400;
				$sType = "";
				break;
			case 2:
				$displayParams["jsTimelineOptions"]["topIntervalUnit"]="HOUR";
				$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="DAY";
				$sTitle = "Last 3 Days";
				$nStartTime = time()- (86400 * 3);
				$sType = "bool15";
				break;
			case 3:
				$displayParams["jsTimelineOptions"]["topIntervalUnit"]="HOUR";
				$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="DAY";
				$sTitle = "Last 1 Week";
				$nStartTime = time()- (86400 * 7);
				$sType = "bool15";
				break;
			case 4:
				$displayParams["jsTimelineOptions"]["topIntervalUnit"]="HOUR";
				$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="DAY";
				$sTitle = "Last 1 Month";
				$nStartTime = time()- (86400 * 30);
				$sType = "bool60";
				break;
			case 5:
				$displayParams["jsTimelineOptions"]["topIntervalUnit"]="DAY";
				$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="MONTH";
				$sTitle = "Last 6 Months";
				$nStartTime = time()- (86400 * 30 * 6);
				$sType = "bool180";
				break;
			case 6:
				$displayParams["jsTimelineOptions"]["topIntervalUnit"]="DAY";
				$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="MONTH";
				$sTitle = "Last 1 Year";
				$nStartTime = time()- (86400 * 365);
				$sType = "bool180";
				break;
			default:
				$nType = 1;
				$sTitle = "Last 24 Hours";
				$nStartTime = time()-86400;
				$sType = "";
				break;
		}
		
		
		
		$displayParams["jsTimeline"] = true;
		$displayParams["jsTimelineData"] = $_SERVER["PHP_SELF"]."?page=".$_REQUEST["page"]."&type=".$_REQUEST["type"]."&ID=".$_REQUEST["ID"]."&serverID=".$_REQUEST["serverID"]."&modID=".$_REQUEST["modID"]."&getTimeLineData=true";

		$displayParams["jsTimelineOptions"]["topCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["bottomCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		//$moduleInfo = $BigDaddyData->GetModuleByID($_REQUEST["modID"]);
		$moduleInfo = $BigDaddyData->GetServerModuleInfoByModuleID($_REQUEST["ID"]);
		
		$sParam = str_replace("[hostname]", "", $moduleInfo["parameters"]);
		$sParam = trim($sParam);
		
		if ($sParam != "")
		{
			$sParam = "(".$sParam.")";
		}
		
		$pageParams["title"]="Detailed History for ".$moduleInfo["module_name"]." $sParam on ".$serverInfo["hostname"];
		if ($_REQUEST["getTimeLineData"] == "true")
		{
			$pageParams["noDisplay"] = 1;
			$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/booleandataeventxml.inc";
		}
		else
		{
			$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermodboolhistorydetails.inc";
		}
		break;
	case "ServerModuleAuditXML":
		$pageParams["noDisplay"] = 1;
		
		$aFilter = array(
		"application" => "server",
		"type" => "server_edit",
		"primaryNumericID" => $_REQUEST["serverID"],
		"secondaryNumericID" => $_REQUEST["ID"]
		);
		
		$aAuditData = $Audit->getAuditData($aFilter, "modifiedDate");
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/auditdataxml.inc";
		
		break;
	case "ServerAuditXML":
		$pageParams["noDisplay"] = 1;
		
		$aFilter = array(
		"application" => "server",
		"type" => "server_edit",
		"primaryNumericID" => $_REQUEST["serverID"]
		);
		
		$aIncident = $BigDaddyData->GetIncidentsByServerID($_REQUEST["serverID"]);
		
		$aAuditData = $Audit->getAuditData($aFilter, "modifiedDate");
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/auditdataxml.inc";
		
		break;
	case "ServerAudit":
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		$pageParams["sectiontitle"]="server";
		
		$displayParams["jsTimeline"] = true;
		$displayParams["jsTimelineData"] = $_SERVER["PHP_SELF"]."?page=ServerAuditXML&ID=".$_REQUEST["ID"]."&serverID=".$_REQUEST["serverID"];
		$displayParams["jsTimelineOptions"]["topCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["bottomCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["topIntervalUnit"]="DAY";
		$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="MONTH";
		
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		
		
		$pageParams["title"]="Audit for ".$serverInfo["hostname"];
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/serveraudit.inc";
		break;
	case "ServerModuleAudit":
		include_once($_SERVER["DOCUMENT_ROOT"]."/server/options.inc");
		$Content->AddOption("opt2", "View Server Details", 0, "{$_SERVER["PHP_SELF"]}?page=ServerViewDetails&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break3", "", 4, "#");
		$Content->AddOption("opt3", "Edit Server Info", 0, "{$_SERVER["PHP_SELF"]}?page=ServerEdit&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break4", "", 4, "#");
		$Content->AddOption("opt4", "Add Module To Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModAdd&serverID=".$_REQUEST["serverID"], "");
		$Content->AddOption("break5", "", 4, "#");
		$Content->AddOption("opt5", "Copy Monitor Modules From Server", 0, "{$_SERVER["PHP_SELF"]}?page=ServerModCopy&serverID=".$_REQUEST["serverID"], "");
		$pageParams["sectiontitle"]="server";
		
		$displayParams["jsTimeline"] = true;
		$displayParams["jsTimelineData"] = $_SERVER["PHP_SELF"]."?page=ServerModuleAuditXML&ID=".$_REQUEST["ID"]."&serverID=".$_REQUEST["serverID"]."&modID=".$_REQUEST["modID"]."&getTimeLineData=true";
		$displayParams["jsTimelineOptions"]["topCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["bottomCentreDate"] = get_time_str(time()-(4*3600),"timeline");
		$displayParams["jsTimelineOptions"]["topIntervalUnit"]="DAY";
		$displayParams["jsTimelineOptions"]["bottomIntervalUnit"]="MONTH";
		
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		$moduleInfo = $BigDaddyData->GetModuleByID($_REQUEST["modID"]);
		$serverModuleInfo = $BigDaddyData->GetServerModuleInfoByModuleID($_REQUEST["ID"]);
		
		$sParam = str_replace("[hostname]", "", $serverModuleInfo["parameters"]);
		$sParam = trim($sParam);
		
		if ($sParam != "")
		{
			$sParam = "(".$sParam.")";
		}
		
		$pageParams["title"]="Audit for ".$serverModuleInfo["module_name"]." $sParam on ".$serverInfo["hostname"];
		$pageParams["include"]=$_SERVER["DOCUMENT_ROOT"]."/server/servermodaudit.inc";
		break;
	case "ServerModuleHistoryNonBooleanGraph":
		$pageParams["noDisplay"] = true;
		require_once(JPGRAPH);
		require_once(JPGRAPH_LINE);	
	
		$serverInfo = $BigDaddyData->GetServerInfoByID($_REQUEST["serverID"]);
		$moduleInfo = $BigDaddyData->GetServerModuleInfoByModuleID($_REQUEST["serverModuleID"]);
		//$nEndTime = time();
		
		switch ($_REQUEST["type"])
		{
			case 1:
				$sTitle = "Last Hour";
				$sTableType = NULL;
				$nStartTime = time() - 3600;
				$sTime = "%H:%M";
				break;
			case 2:
				$sTitle = "Last 24 Hours";
				$sTableType = "ma15";
				//$sTableType = NULL;
				$nStartTime = time() - 86400;
				$sTime = "%H:%M";
				break;
			case 3:
				$sTitle = "Last 3 Days";
				$sTableType = "ma15";
				//$sTableType = NULL;
				$nStartTime = time() - 3 * 86400;
				$sTime = "%d/%m/%H:%M";
				break;
			case 4:
				$sTitle = "Last 7 Days";
				$sTableType = "ma60";
				$nStartTime = time() - 7 * 86400;
				$sTime = "%d/%m/%H:%M";
				break;
			case 5:
				$sTitle = "Last 30 Days";
				$sTableType = "ma60";
				$nStartTime = time() - 30 * 86400;
				$sTime = "%d/%m/%H:%M";
				break;
			case 6:
				$sTitle = "Last 180 Days (6 Months)";
				$sTableType = "ma180";
				$nStartTime = time() - 180 * 86400;
				$sTime = "%d/%m/%H:%M";
				break;
			case 7:
				$sTitle = "Last Year";
				$sTableType = "ma180";
				$nStartTime = time() - 365 * 86400;
				$sTime = "%d/%m/%H:%M";
				break;
			case 8:
				$nStartTime = $_REQUEST["nStartTime"];
				$nEndTime = $_REQUEST["nEndTime"];
				$sTitle = "From ".get_time_str($nStartTime, 1)." To ".get_time_str($nEndTime, 1);
				$sTableType = "nonbool";
				
				$sTime = "%H:%M";
				break;
		}
		
		$sParam = str_replace("[hostname]", "", $moduleInfo["parameters"]);
		$sParam = trim($sParam);
		
		if ($sParam != "")
		{
			$sParam = "(".$sParam.")";
		}
		
		$sTitle.=": ".$serverInfo["hostname"]." ".$moduleInfo["module_name"]." $sParam";
		$aResult = $BigDaddyHistory->GetNonBooleanHistoryByTime($_REQUEST["serverModuleID"], $nStartTime, $sTableType, $nEndTime);
		

		if (is_array($aResult))
		{
			$i=0;
			foreach ($aResult as $aRow)
			{
				$xdata[$i] = strftime($sTime, $aRow["mon_lastreport"]);
				$ydata[$i] = $aRow["lastreport"];
				$i++;
			}
			
			//var_dump($xdata);
		
			//Create Graph
			$graph = new Graph(900, 250, "auto");
			$graph->img->SetMargin(60,20,20,40); 
			$graph->SetScale("textlin");
			$graph->xaxis->SetTickLabels($xdata);
			$graph->xaxis->SetTextLabelInterval(1);
			
			$nInterval = ceil(count($ydata)/5);

			$graph->xaxis->SetTextTickInterval($nInterval);
			$graph->title->Set($sTitle);
			$graph->title->SetFont(FF_FONT1, FS_NORMAL, 10);
			$graph->xaxis->title->Set("Time");
			//$graph->yaxis->title->Set("Report Value");
			
			//$graph->legend->pos(0.05,0.3, "right", "center");
			
			//Plot the line
			$lineplot= new LinePlot($ydata);
			$lineplot->SetFillColor("blue");
			//$lineplot->SetLegend("Uptime");
			
			$graph->Add($lineplot);
			
			$graph->Stroke();
	
		}
		break;
	case "":
	default:
		$App->sTitle = "Main Page";
		$App->sHome = "/";
		$pageParams["title"]="BigDaddy Dashboard";
		$pageParams["sectiontitle"]="main";
		break;
}
?>
